home *** CD-ROM | disk | FTP | other *** search
- Path: casbah.acns.nwu.edu!muzaffar
- From: muzaffar@casbah.acns.nwu.edu (Usman Muzaffar)
- Newsgroups: comp.lang.c
- Subject: Re: help with bytes -> long
- Date: 7 Mar 1996 03:53:27 GMT
- Organization: Northwestern University, Evanston IL
- Message-ID: <4hlmjn$qju@news.acns.nwu.edu>
- References: <4hl3lj$oue@frodo.smartlink.net>
- NNTP-Posting-Host: casbah.acns.nwu.edu
-
- In article <4hl3lj$oue@frodo.smartlink.net>,
- Thomas Hackbarth <thomash@warp10.smartlink.net> wrote:
- >I suck at bit manipulation. I need a macro to convert RGB to a long so I
- >get this output
- >
- >RED GREEN BLUE -> LONG
- >FF 00 FF FF 00 FF 00
- >
-
- Well, if your compiler can handle long constants, what's wrong with
-
- #define RGB2LONG(r,g,b) (r*16777216+g*65536+b*256)
-
- It's not quite as slow as it looks: most compiler insert the actual
- constant when faced with constx*consty .
-
- -usman
- muzaffar@casbah.acns.nwu.edu
-
-
-
-